#!/usr/bin/env python

import wx
import resource.dimen as rDimen

from _files import Files
from _manga import Manga
from _chapter import Chapter

class Form(wx.Panel):
    '''Form class
    
    @author Julot <andy.julot@gmail.com>
    @since Friday, April 13, 2012. 01:58 PM'''
    
    def __init__(self, parent):
        style = wx.BORDER_THEME | wx.TAB_TRAVERSAL
        super(Form, self).__init__(parent, style=style)
        
        spacer = rDimen.spacer / 2
        sizer = wx.FlexGridSizer(cols=2, vgap=spacer, hgap=spacer)
        sizer.AddGrowableCol(1)
        
        labelFlag = wx.ALIGN_CENTER_VERTICAL
        
        c = '4-Koma'
        label = wx.StaticText(self, label='%s:' % c)
        sizer.Add(label, flag=labelFlag)
        
        self.manga = Manga(self)
        sizer.Add(self.manga, 0, wx.GROW)
        
        c = 'Chapter'
        label = wx.StaticText(self, label='%s:' % c)
        sizer.Add(label, flag=wx.ALIGN_TOP)
        
        self.chapter = Chapter(self)
        sizer.Add(self.chapter, 0, wx.GROW)
        
        c = 'Page'
        label = wx.StaticText(self, label='%s:' % c)
        sizer.Add(label, flag=wx.ALIGN_TOP)
        
        self.sequence = wx.TextCtrl(self)
        sizer.Add(self.sequence, 0, wx.GROW)
        
        c = 'Sub Page'
        label = wx.StaticText(self, label='%s:' % c)
        sizer.Add(label, flag=wx.ALIGN_TOP)
        
        self.subSequence = wx.TextCtrl(self)
        sizer.Add(self.subSequence, 0, wx.GROW)
        
        c = 'Language'
        label = wx.StaticText(self, label='%s:' % c)
        sizer.Add(label, flag=wx.ALIGN_TOP)
        
        self.language = wx.TextCtrl(self)
        sizer.Add(self.language, 0, wx.GROW)
        
        c = 'Uploader'
        label = wx.StaticText(self, label='%s:' % c)
        sizer.Add(label, flag=wx.ALIGN_TOP)
        
        self.name = wx.TextCtrl(self)
        sizer.Add(self.name, 0, wx.GROW)
        
        c = 'Email'
        label = wx.StaticText(self, label='%s:' % c)
        sizer.Add(label, flag=wx.ALIGN_TOP)
        
        self.email = wx.TextCtrl(self)
        sizer.Add(self.email, 0, wx.GROW)
        
        sizer2 = wx.BoxSizer(wx.VERTICAL)
        
        self.files = Files(self)
        sizer2.Add(self.files, 1, wx.GROW)
        sizer2.AddSpacer(spacer)
        
        sizer2.Add(sizer, 0, wx.GROW)
        
        self.SetSizerAndFit(sizer2)
    
    def disable(self):
        self.code.Disable()
        self.synopsis.Disable()
    
    def enable(self):
        self.code.Enable()
        self.synopsis.Enable()